package com.hx.setting.action.request;

import com.hx.setting.entity.Entity;
import com.hx.setting.model.Page.Dir;
import com.hx.setting.model.Page;

/**
 * Generate Date : 2014-03-16
 * Generate Version : v3.0
 * Generate Name : Honey v3.1 Test
 * Generate User : THINK
 * JDK Version : 1.5
 */
public abstract class BaseActionRequest
{

	private int		total	= 0;				/*一共有多少记录*/

	private int		limit	= Page.PAGE_COUNT;

	private int		start	= 0;

	private String	sort;

	/** 排序方式(DESC或者ASC) */
	private Dir		dir		= Dir.DEFAULT;

	private Page	cur		= null;

	public final int getTotal()
	{
		return total;
	}

	public final void setTotal(int total)
	{
		this.total = total;
	}

	public final int getLimit()
	{
		return limit;
	}

	public final void setInterval(int interval)
	{
		setLimit( interval );
	}

	public final void setLimit(int limit)
	{
		if ( limit <= 0 )
		{
			this.limit = Page.PAGE_COUNT;
		}
		else
		{
			this.limit = limit;
		}
	}

	public final int getStart()
	{
		return start;
	}

	public final void setBegin(int begin)
	{
		this.start = begin;
	}

	public final void setStart(int start)
	{
		this.start = start;
	}

	public String getSort()
	{
		return sort;
	}

	public void setSort(String sort)
	{
		this.sort = sort;
	}

	public Dir getDir()
	{
		return dir;
	}

	public void setDir(String dir)
	{
		this.dir = "asc".equalsIgnoreCase( dir ) ? Dir.ASC : Dir.DESC;
	}

	public final Page getPage()
	{
		if ( cur == null )
		{
			cur = new Page( start, limit, total );
			cur.setOrderBy( sort ,dir );
		}
		return cur;
	}

	public abstract Entity cloneEntity();
}
/* Honey v3.1 Test - version:1 - OriginalChecksum:B532fb9b31d00d8dfa060dd4b0e2512b9 (do not edit this line) */
